// 
//  Copyright (C) 2009 Jacek Trubłajewicz
// 
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
// 
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//  GNU General Public License for more details.
//  
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// 

using System;

namespace wxGadu
{
	/// <summary>
	/// Simple representation of <c>wx.Font</c> class
	/// that can be serialize
	/// </summary>
	[Serializable]
	public class Font
	{
		private int size;
		private string faceName;
		private wx.FontFamily family;
		private wx.FontStyle style;
		private wx.FontWeight weight;
		
		/// <summary>
		/// Ctor
		/// </summary>
		public Font()
		{
			wx.Font defaultFont = wx.SystemSettings.GetFont(wx.SystemFont.wxSYS_DEFAULT_GUI_FONT);
			size = defaultFont.PointSize;
			family = defaultFont.Family;
			style = defaultFont.Style;
			weight = defaultFont.Weight;
			faceName = defaultFont.FaceName;
		}
		
		/// <summary>
		/// Ctor
		/// </summary>
		/// <param name="f1">
		/// A <see cref="wx.Font"/>
		/// font used for initialization
		/// </param>
		public Font(wx.Font f1)
		{
			size = f1.PointSize;
			family = f1.Family;
			style = f1.Style;
			weight = f1.Weight;
			faceName = f1.FaceName;
		}
		
		/// <summary>
		/// Conversion operator
		/// </summary>
		/// <param name="f">
		/// A <see cref="Font"/>
		/// </param>
		/// <returns>
		/// A <see cref="wx.Font"/>
		/// </returns>
		public static explicit operator wx.Font(Font f)
		{
			wx.Font tmp = new wx.Font(f.size, f.family, f.style, f.weight);
			tmp.FaceName = f.faceName;
			
			return tmp;
		}
		
		//// <value>
		/// Font size
		/// </value>
		public int Size
		{
			get { return size; }
			set { size = value; }
		}
		
		//// <value>
		/// Font family
		/// </value>
		public wx.FontFamily Family
		{
			get { return family; }
			set { family = value; }
		}
		
		//// <value>
		/// Font style
		/// </value>
		public wx.FontStyle Style
		{
			get { return style; }
			set { style = value; }
		}
		
		//// <value>
		/// Font weight
		/// </value>
		public wx.FontWeight Weight
		{
			get { return weight; }
			set { weight = value; }
		}
		
		//// <value>
		/// Font face
		/// </value>
		public string FaceName
		{
			get { return faceName; }
			set { faceName = value; }
		}
	}
}
